<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>未读消息</title>
</head>
<body>
<div id="test"></div>

<script type="text/javascript" src="../js/react.development.js"></script>
<script type="text/javascript" src="../js/react-dom.development.js"></script>
<script type="text/javascript" src="../js/prop-types.js"></script>
<script type="text/javascript" src="../js/babel.min.js"></script>
<script type="text/babel">/*告诉babel.js解析里面的jsx的代码*/

class Messagebox extends React.Component{

    constructor(props){
        super(props)

    }

    render(){
        const unreadmes = messages;
        return(
            <div>
                <h1>hzqiuxm:</h1>
                {
                    unreadmes.length>0 && <h2>你有{unreadmes.length}条消息未读</h2>
                }
            </div>
        )
    }
}

const messages = ['hello','react','some message']

// 2. 将虚拟DOM渲染到页面真实DOM容器中
ReactDOM.render(<Messagebox/>, document.getElementById('test'))
</script>
</body>
</html>